<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------
namespace addon\cms\model;
use \think\Request;
use app\common\model\AddonBase;
use Think\Db;
class PostsComments extends AddonBase
{
    protected $insert = ['datetime','reply_author',"user_id"];

    protected function setDatetimeAttr($value){
    	return time();
    }

    protected function setReplyAuthorAttr($value){
        if(input("pid")>0){
            $list=Db::name("PostsComments")->field("author")->where(["id"=>input("pid")])->find();
            return $list['author'];
        }
    }

    protected function setUserIdAttr($value){
        return session("tpf_login_sign")['userid'];
    }
}
